<script setup lang="ts">
import { ref, watch } from 'vue';

const count = ref(99)

// 1. 使用watch监听一个响应式数据
watch(count, (newValue, oldValue) => {
  console.log(`旧值: ${oldValue}, 新值: ${newValue}`);
})
</script>


<template>
  <div id="app">
    <p>数量: {{ count }}</p>
    <button @click="count++">改变数量</button>
  </div>
</template>

<style></style>
